#lang rosetta-racket


(require "utils.rkt")

(provide ysios-roof
         ysios-curve)


(define (ysios-roof cs1 cs2 cs3 cs4)
  (if (empty? (rest cs1))
      (list)
      (cons
       (prism
        (list (first cs1) (first cs3) (first cs4) (first cs2))
        (- (xyz-x (second cs1)) (xyz-x (first cs1))))
       (ysios-roof (rest cs1) (rest cs2) (rest cs3) (rest cs4)))))

(define (ysios-curve p a b c d)
  (enumerate-n
   (λ (ti)
     (if (<= (- pi/2) ti pi/2)
         (+xyz p ti (* c (cos ti)) (* d (cos ti)))
         (+xyz p ti (* a (cos ti)) (* b (cos ti)))))
   (* -7 pi) (* +7 pi) 150))